-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add “node” to Jest's moduleFileExtensions #2738
Conversation
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
Thanks for the catch. |
Thanks for the merge. This is for projects that are using the same setup for the server. I have my backend code in |
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
Hi there! This change is out in |
Hi. I tested |
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
This is the same issue documented in react-script PR #2738 (facebook/create-react-app#2738), which has already been merged.
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code.
Jest’s default value for its
moduleFileExtensions
option is["js", "json", "jsx", "node"]
. CRA was not using this option before version 1.0.8, so this default list was used.PR #2511 (merged in version 1.0.8) sets this option to
["web.js", "js", "json", "web.jsx", "jsx"]
. The PR is about adding.web
extensions, but it is also removing.node
because it is not included like other default extensions.Why is this a bug?
Packages using native code through
node-gyp
import files with.node
extension. Using those packages fails the tests with aCannot find module …
error.This used to work with version 1.0.7.
Reproduction and testing
This repo is a minimal reproduction of this bug. Tests fail there. Changing
react-scripts
to 1.0.7 or manually applying this change tonode_modules/react-scripts/scripts/utils/createJestConfig.js
fixes the problem.